/**
 * 
 */
package com.ncr.travel.appmgr.model;

import java.util.List;

import com.ncr.travel.appmgr.model.shared.Rule;
import com.ncr.travel.appmgr.model.shared.RuleControls;
import com.ncr.travel.appmgr.model.shared.TableDefinition;

/**
 * @author sn185078
 *
 */
public class RuleJson extends ConfigurationJson implements Rule {

	private String ruleName;
	private String screenName;
	private List<TableDefinition> tableDefinition;
	private String description;
	private RuleControls ruleControls;

	public RuleJson() {
		super();
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Rule#getRuleName()
	 */
	@Override
	public String getRuleName() {
		return ruleName;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Rule#setRuleName(java.lang.String)
	 */
	@Override
	public void setRuleName(String ruleName) {
		this.ruleName = ruleName;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Rule#getScreenName()
	 */
	@Override
	public String getScreenName() {
		return screenName;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Rule#setScreenName(java.lang.String)
	 */
	@Override
	public void setScreenName(String screenName) {
		this.screenName = screenName;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Rule#getTableDefinition()
	 */
	@Override
	public List<TableDefinition> getTableDefinition() {
		return tableDefinition;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Rule#setTableDefinition(java.util.List)
	 */
	@Override
	public void setTableDefinition(List<TableDefinition> tableDefinition) {
		this.tableDefinition = tableDefinition;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Rule#getDescription()
	 */
	@Override
	public String getDescription() {
		return description;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Rule#setDescription(java.lang.String)
	 */
	@Override
	public void setDescription(String description) {
		this.description = description;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Rule#getRuleControls()
	 */
	@Override
	public RuleControls getRuleControls() {
		return ruleControls;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Rule#setRuleControls(com.ncr.travel.appmgr.model.shared.RuleControls)
	 */
	@Override
	public void setRuleControls(RuleControls ruleControls) {
		this.ruleControls = ruleControls;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((description == null) ? 0 : description.hashCode());
		result = prime * result + ((ruleControls == null) ? 0 : ruleControls.hashCode());
		result = prime * result + ((ruleName == null) ? 0 : ruleName.hashCode());
		result = prime * result + ((screenName == null) ? 0 : screenName.hashCode());
		result = prime * result + ((tableDefinition == null) ? 0 : tableDefinition.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		RuleJson other = (RuleJson) obj;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (ruleControls == null) {
			if (other.ruleControls != null)
				return false;
		} else if (!ruleControls.equals(other.ruleControls))
			return false;
		if (ruleName == null) {
			if (other.ruleName != null)
				return false;
		} else if (!ruleName.equals(other.ruleName))
			return false;
		if (screenName == null) {
			if (other.screenName != null)
				return false;
		} else if (!screenName.equals(other.screenName))
			return false;
		if (tableDefinition == null) {
			if (other.tableDefinition != null)
				return false;
		} else if (!tableDefinition.equals(other.tableDefinition))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "RuleJson [ruleName=" + ruleName + ", screenName=" + screenName + ", tableDefinition=" + tableDefinition + ", description=" + description + ", ruleControls=" + ruleControls + ", getId()=" + getId()
				+ ", getName()=" + getName() + "]";
	}

}
